(function (Vue) {
    Vue.component("home", {
        template: `
            <h1>主页组件</h1>
            `,
    });
    Vue.component("product", {
        template: `
            <h1>产品组件</h1>
            `,
    });
    Vue.component("profile", {
        template: `
            <h1>公司介绍组件</h1>
            `,
    });
    let routes = [{
            path: "/home",
            component: "home",
        },
        {
            path: "/product",
            component: "product",
        },
        {
            path: "/profile",
            component: "profile",
        }
    ];

    window.addEventListener("hashchange", function (e) {
        console.log(window.location.hash);
        let duix = window.location.hash.split("#")[1];
        let mubiao = routes.find(v => {
            if (v.path === duix) {
                return true;
            }
        })
        vm.shanshanid = mubiao.component;
    })

})(Vue)